package com.das.mechanic_base.widget;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.RectF;
import android.util.AttributeSet;
import android.view.View;

import androidx.annotation.Nullable;

import com.das.mechanic_base.utils.X3ScreenUtils;

public class X3AppUpdateView extends View {

    private Paint mPaint;

    private int radius;

    private Context mContext;

    public X3AppUpdateView(Context context) {
        this(context,null);
    }

    public X3AppUpdateView(Context context, @Nullable AttributeSet attrs) {
        this(context, attrs,0);
    }

    public X3AppUpdateView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        this.mContext = context;
        initView();
    }

    private void initView() {
        mPaint = new Paint();
        mPaint.setStyle(Paint.Style.FILL);
        mPaint.setAntiAlias(true);

        radius = X3ScreenUtils.dipToPx(6,mContext);
    }

    @Override
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);

        // 绘制底色
        mPaint.setColor(Color.parseColor("#E6E6EB"));
        canvas.drawRoundRect(new RectF(0,0,getWidth(),getHeight()),radius,radius,mPaint);

    }
}
